set :application, "mum.ajaxizeyourself.com"
set :repository,  "http://mumimfine.googlecode.com/svn/trunk"
set :use_sudo, false

set :deploy_to, "/home/deployer/#{application}"

set :dreamhost, '67.205.20.52'
set :user,  'deployer'

role :app, dreamhost
role :web, dreamhost
role :db,  dreamhost, :primary => true

task :after_update_code, :roles => [:app, :db, :web] do
  # fix permissions
  run "chmod +x #{release_path}/script/process/reaper"
  run "chmod +x #{release_path}/script/process/spawner"
  run "chmod 755 #{release_path}/public/dispatch.*"
  run "rm #{release_path}/config/database.yml"
  run "ln -s #{shared_path}/configs/database.yml #{latest_release}/config/database.yml;"
  run "ln -s #{shared_path}/log #{latest_release}/public/log;"
  run "ln -s #{shared_path}/configs/GeoLiteCity.dat #{latest_release}/config/GeoLiteCity.dat;"
end

task :restart, :roles => :app do
  run "ruby #{current_path}/script/process/reaper --dispatcher=dispatch.fcgi"
end

task :after_symlink, :roles => [:web, :app] do
  # Make dispatcher executable
  run "chmod a+x #{current_path}/public/dispatch.fcgi"
end